import axios from 'axios';

function UploadPic() {
  const upload = async ({ target }) => {
    const files = new FormData();
    files.append('file', target.files[0]);
    console.log(target.files[0]);

    const { data } = await axios.post('/api/user/uploadAvator', files, {
      headers: {
        'Content-Type': 'multipart/form-data',
      },
    });
    console.log(data);
  };
  return (
    <>
      <div>
        <input type="file" onChange={upload} />
      </div>
    </>
  );
}

export default UploadPic;
